package com.portal.innovation.config;


import com.portal.innovation.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
public class ExceptionHandler {

    //自定义异常处理器
    @org.springframework.web.bind.annotation.ExceptionHandler(SysException.class)
    @ResponseBody
    public R error(SysException e){
        e.printStackTrace();
        return R.error().put("msg", e.msg);
    }

    @org.springframework.web.bind.annotation.ExceptionHandler(Exception.class)
    @ResponseBody
    public R error(Exception e){
        e.printStackTrace();
        return R.error().put("msg", "服务器内部错误！！");
    }



}
